﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using YArchitech.Controls;
using YArchitech.LIB;

namespace HYRElectric.Calculate
{
	public partial class DlgAddRI_RCR : System.Windows.Forms.Form
	{
		public DlgAddRI_RCR(DlgLYXS main)
		{
			this.mainForm = main;
			this.InitializeComponent();
		}

		private void button2_Click_1(object sender, EventArgs e)
		{
			base.Close();
		}

		private void button1_Click_1(object sender, EventArgs e)
		{
			double obj = 0.0;
			if (double.TryParse(this.tbxRI_RCR.Text, out obj))
			{
				bool flag = false;
				IEnumerator enumerator = ((IEnumerable)this.mainForm.dataGridView.Rows).GetEnumerator();
				{
					while (enumerator.MoveNext())
					{
						if (Convert.ToDouble(((DataGridViewRow)enumerator.Current).HeaderCell.Value).Equals(obj))
						{
							flag = true;
							break;
						}
					}
				}
				if (!flag)
				{
					DataGridViewRow dataGridViewRow = new DataGridViewRow();
					dataGridViewRow.HeaderCell.Value = obj.ToString();
					this.mainForm.dataGridView.Rows.Add(dataGridViewRow);
				}
				else
				{
					MessageBox.Show("数据已存在！");
				}
				base.Close();
				return;
			}
			MessageBox.Show("请正确填写数据");
		}

		private void DlgAddRI_RCR_Load(object sender, EventArgs e)
		{
			//base.Icon = Resource.YArchitechIcon;
		}

		private DlgLYXS mainForm;
	}
}
